<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>array</title>
    <script src="../node_modules/vue/dist/vue.global.js"></script>
  </head>
  <body>
    <div id="app"></div>
    <script>
      const { reactive, effect, computed } = Vue
      const data = [1, 2, 3]
      const state = reactive(data)
      const stateComp = computed(() => state)

      effect(() => {
        document.getElementById('app').innerHTML = `这个数组是:${stateComp.value}`
      })

      setTimeout(() => {
        state.push(4)
      }, 1000)
    </script>
  </body>
</html>
